home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 November / Cd users extra 14.iso / prog / inst / hidemenu / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-11-29  |  1.7 KB  |  61 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2040
  5.    ClientLeft      =   3525
  6.    ClientTop       =   4470
  7.    ClientWidth     =   3030
  8.    Height          =   2730
  9.    Left            =   3465
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   2040
  12.    ScaleWidth      =   3030
  13.    Top             =   3840
  14.    Width           =   3150
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Hide Menus"
  17.       Height          =   495
  18.       Left            =   840
  19.       TabIndex        =   0
  20.       Top             =   600
  21.       Width           =   1215
  22.    End
  23.    Begin VB.Menu mnuFile 
  24.       Caption         =   "&File"
  25.       Begin VB.Menu mnuFileExit 
  26.          Caption         =   "E&xit"
  27.       End
  28.    End
  29.    Begin VB.Menu mnuHelp 
  30.       Caption         =   "&Help"
  31.       Begin VB.Menu mnuHelpAbout 
  32.          Caption         =   "&About..."
  33.       End
  34.    End
  35. Attribute VB_Name = "Form1"
  36. Attribute VB_Creatable = False
  37. Attribute VB_Exposed = False
  38. Option Explicit
  39. Private Declare Function SetMenu Lib "user32" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
  40. Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
  41. Private Sub Command1_Click()
  42. Static hMenu As Long
  43.     If hMenu = 0 Then
  44.         ' Get the menu handle and hide the menu.
  45.         hMenu = GetMenu(hwnd)
  46.         SetMenu hwnd, 0
  47.         Command1.Caption = "Show Menus"
  48.     Else
  49.         ' Restore the old menu.
  50.         SetMenu hwnd, hMenu
  51.         hMenu = 0
  52.         Command1.Caption = "Hide Menus"
  53.     End If
  54. End Sub
  55. Private Sub mnuFileExit_Click()
  56.     Unload Me
  57. End Sub
  58. Private Sub mnuHelpAbout_Click()
  59.     MsgBox "Click the button to hide/show the menus."
  60. End Sub
  61.